GtkTextRenderer *text_renderer = GTK_TEXT_RENDERER (renderer);
GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer);
GdkColor *bg_color, *fg_color, *underline_color;
- GdkPixmap *fg_stipple, *bg_stipple;
GtkTextAppearance *appearance;
PANGO_RENDERER_CLASS (_gtk_text_renderer_parent_class)->prepare_run (renderer, run);
underline_color = fg_color;
text_renderer_set_gdk_color (text_renderer, PANGO_RENDER_PART_UNDERLINE, underline_color);
-
- fg_stipple = appearance->fg_stipple;
- if (fg_stipple && text_renderer->screen != gdk_drawable_get_screen (fg_stipple))
- {
- g_warning ("gtk_text_renderer_prepare_run:\n"
- "The foreground stipple bitmap has been created on the wrong screen.\n"
- "Ignoring the stipple bitmap information.");
- fg_stipple = NULL;
- }
-
- gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_FOREGROUND, fg_stipple);
- gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_STRIKETHROUGH, fg_stipple);
- gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_UNDERLINE, fg_stipple);
-
- bg_stipple = appearance->draw_bg ? appearance->bg_stipple : NULL;
-
- if (bg_stipple && text_renderer->screen != gdk_drawable_get_screen (bg_stipple))
- {
- g_warning ("gtk_text_renderer_prepare_run:\n"
- "The background stipple bitmap has been created on the wrong screen.\n"
- "Ignoring the stipple bitmap information.");
- bg_stipple = NULL;
- }
-
- gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_BACKGROUND, bg_stipple);
}
static void
PROP_FOREGROUND,
PROP_BACKGROUND_GDK,
PROP_FOREGROUND_GDK,
- PROP_BACKGROUND_STIPPLE,
- PROP_FOREGROUND_STIPPLE,
PROP_FONT,
PROP_FONT_DESC,
PROP_FAMILY,
/* Whether-a-style-arg-is-set args */
PROP_BACKGROUND_SET,
PROP_FOREGROUND_SET,
- PROP_BACKGROUND_STIPPLE_SET,
- PROP_FOREGROUND_STIPPLE_SET,
PROP_FAMILY_SET,
PROP_STYLE_SET,
PROP_VARIANT_SET,
P_("Whether the background color fills the entire line height or only the height of the tagged characters"),
FALSE,
GTK_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_BACKGROUND_STIPPLE,
- g_param_spec_object ("background-stipple",
- P_("Background stipple mask"),
- P_("Bitmap to use as a mask when drawing the text background"),
- GDK_TYPE_PIXMAP,
- GTK_PARAM_READWRITE));
-
-
g_object_class_install_property (object_class,
PROP_FOREGROUND,
g_param_spec_string ("foreground",
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_FOREGROUND_STIPPLE,
- g_param_spec_object ("foreground-stipple",
- P_("Foreground stipple mask"),
- P_("Bitmap to use as a mask when drawing the text foreground"),
- GDK_TYPE_PIXMAP,
- GTK_PARAM_READWRITE));
-
g_object_class_install_property (object_class,
PROP_DIRECTION,
g_param_spec_enum ("direction",
P_("Background full height set"),
P_("Whether this tag affects background height"));
- ADD_SET_PROP ("background-stipple-set", PROP_BACKGROUND_STIPPLE_SET,
- P_("Background stipple set"),
- P_("Whether this tag affects the background stipple"));
-
ADD_SET_PROP ("foreground-set", PROP_FOREGROUND_SET,
P_("Foreground set"),
P_("Whether this tag affects the foreground color"));
- ADD_SET_PROP ("foreground-stipple-set", PROP_FOREGROUND_STIPPLE_SET,
- P_("Foreground stipple set"),
- P_("Whether this tag affects the foreground stipple"));
-
ADD_SET_PROP ("editable-set", PROP_EDITABLE_SET,
P_("Editability set"),
P_("Whether this tag affects text editability"));
}
break;
- case PROP_BACKGROUND_STIPPLE:
- {
- GdkBitmap *bitmap = g_value_get_object (value);
-
- text_tag->bg_stipple_set = TRUE;
- g_object_notify (object, "background-stipple-set");
-
- if (text_tag->values->appearance.bg_stipple != bitmap)
- {
- if (bitmap != NULL)
- g_object_ref (bitmap);
-
- if (text_tag->values->appearance.bg_stipple)
- g_object_unref (text_tag->values->appearance.bg_stipple);
-
- text_tag->values->appearance.bg_stipple = bitmap;
- }
- }
- break;
-
- case PROP_FOREGROUND_STIPPLE:
- {
- GdkBitmap *bitmap = g_value_get_object (value);
-
- text_tag->fg_stipple_set = TRUE;
- g_object_notify (object, "foreground-stipple-set");
-
- if (text_tag->values->appearance.fg_stipple != bitmap)
- {
- if (bitmap != NULL)
- g_object_ref (bitmap);
-
- if (text_tag->values->appearance.fg_stipple)
- g_object_unref (text_tag->values->appearance.fg_stipple);
-
- text_tag->values->appearance.fg_stipple = bitmap;
- }
- }
- break;
-
case PROP_FONT:
{
PangoFontDescription *font_desc = NULL;
text_tag->fg_color_set = g_value_get_boolean (value);
break;
- case PROP_BACKGROUND_STIPPLE_SET:
- text_tag->bg_stipple_set = g_value_get_boolean (value);
- if (!text_tag->bg_stipple_set &&
- text_tag->values->appearance.bg_stipple)
- {
- g_object_unref (text_tag->values->appearance.bg_stipple);
- text_tag->values->appearance.bg_stipple = NULL;
- }
- break;
-
- case PROP_FOREGROUND_STIPPLE_SET:
- text_tag->fg_stipple_set = g_value_get_boolean (value);
- if (!text_tag->fg_stipple_set &&
- text_tag->values->appearance.fg_stipple)
- {
- g_object_unref (text_tag->values->appearance.fg_stipple);
- text_tag->values->appearance.fg_stipple = NULL;
- }
- break;
-
case PROP_FAMILY_SET:
case PROP_STYLE_SET:
case PROP_VARIANT_SET:
g_value_set_boxed (value, &tag->values->appearance.fg_color);
break;
- case PROP_BACKGROUND_STIPPLE:
- if (tag->bg_stipple_set)
- g_value_set_object (value, tag->values->appearance.bg_stipple);
- break;
-
- case PROP_FOREGROUND_STIPPLE:
- if (tag->fg_stipple_set)
- g_value_set_object (value, tag->values->appearance.fg_stipple);
- break;
-
case PROP_FONT:
{
gchar *str;
g_value_set_boolean (value, tag->fg_color_set);
break;
- case PROP_BACKGROUND_STIPPLE_SET:
- g_value_set_boolean (value, tag->bg_stipple_set);
- break;
-
- case PROP_FOREGROUND_STIPPLE_SET:
- g_value_set_boolean (value, tag->fg_stipple_set);
- break;
-
case PROP_FAMILY_SET:
case PROP_STYLE_SET:
case PROP_VARIANT_SET:
if (src == dest)
return;
- /* Add refs */
-
- if (src->appearance.bg_stipple)
- g_object_ref (src->appearance.bg_stipple);
-
- if (src->appearance.fg_stipple)
- g_object_ref (src->appearance.fg_stipple);
-
/* Remove refs */
- if (dest->appearance.bg_stipple)
- g_object_unref (dest->appearance.bg_stipple);
-
- if (dest->appearance.fg_stipple)
- g_object_unref (dest->appearance.fg_stipple);
-
if (dest->font)
pango_font_description_free (dest->font);
{
g_assert (!values->realized);
- if (values->appearance.bg_stipple)
- g_object_unref (values->appearance.bg_stipple);
-
- if (values->appearance.fg_stipple)
- g_object_unref (values->appearance.fg_stipple);
-
if (values->tabs)
pango_tab_array_free (values->tabs);
dest->pg_bg_color = gdk_color_copy (vals->pg_bg_color);
}
- if (tag->bg_stipple_set)
- {
- g_object_ref (vals->appearance.bg_stipple);
- if (dest->appearance.bg_stipple)
- g_object_unref (dest->appearance.bg_stipple);
- dest->appearance.bg_stipple = vals->appearance.bg_stipple;
-
- dest->appearance.draw_bg = TRUE;
- }
-
- if (tag->fg_stipple_set)
- {
- g_object_ref (vals->appearance.fg_stipple);
- if (dest->appearance.fg_stipple)
- g_object_unref (dest->appearance.fg_stipple);
- dest->appearance.fg_stipple = vals->appearance.fg_stipple;
- }
-
if (vals->font)
{
if (dest->font)
return
tag->bg_color_set ||
- tag->bg_stipple_set ||
tag->fg_color_set ||
- tag->fg_stipple_set ||
tag->strikethrough_set ||
tag->bg_full_height_set ||
tag->pg_bg_color_set;
attrs->appearance.fg_color.green,
attrs->appearance.fg_color.blue);
break;
- case ATK_TEXT_ATTR_BG_STIPPLE:
- value = g_strdup (atk_text_attribute_get_value (attr, attrs->appearance.bg_stipple ? 1 : 0));
- break;
- case ATK_TEXT_ATTR_FG_STIPPLE:
- value = g_strdup (atk_text_attribute_get_value (attr, attrs->appearance.fg_stipple ? 1 : 0));
- break;
case ATK_TEXT_ATTR_WRAP_MODE:
value = g_strdup (atk_text_attribute_get_value (attr, attrs->wrap_mode));
break;
}
val_set = FALSE;
- temp_tags = tags;
- while (temp_tags && !val_set)
- {
- GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
-
- val_set = tag->fg_stipple_set;
- if (val_set)
- attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
- ATK_TEXT_ATTR_FG_STIPPLE);
- temp_tags = temp_tags->next;
- }
- val_set = FALSE;
-
- temp_tags = tags;
- while (temp_tags && !val_set)
- {
- GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
-
- val_set = tag->bg_stipple_set;
- if (val_set)
- attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
- ATK_TEXT_ATTR_BG_STIPPLE);
- temp_tags = temp_tags->next;
- }
- val_set = FALSE;
-
temp_tags = tags;
while (temp_tags && !val_set)
{